package com.demo.hazelcast.config;

import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MapStoreConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class HazelcastConfiguration {
    @Bean
    public Config hazelCastConfig() {
        Config config = new Config();
        //1.创建一个实例
        //2.创建集群map
        config.setInstanceName("hazelcast-instance").

                addMapConfig(
                        new MapConfig()
                                .setMapStoreConfig(new MapStoreConfig())
                                .setName("configuration")
                                .setTimeToLiveSeconds(0));
        return config;
    }
}